package com.janko.eurekacustomer.rabbitmq;

import org.springframework.amqp.rabbit.annotation.*;
import org.springframework.stereotype.Component;
import java.util.Map;

/**
 * @Author nyk
 * @Date 2022/4/9 17:17
 * @Version 1.0
 * @Desc Fanout扇形交换机模式接收器
 */
@Component
public class FanoutReceiver {

    @RabbitHandler
    @RabbitListener(bindings = @QueueBinding(
            value = @Queue(value = "fanout.A", autoDelete = "false"),
            exchange = @Exchange(value = "fanoutExchange", delayed = "true")))
    public void fanoutAProcess(Map testMessage) {
        System.out.println("【FanoutReceiverA】消费者收到消息  : " +testMessage.toString());
    }

//    @RabbitHandler
//    @RabbitListener(bindings = @QueueBinding(
//            value = @Queue(value = "fanout.B", autoDelete = "false"),
//            exchange = @Exchange(value = "fanoutExchange", delayed = "true")))
//    public void fanoutBProcess(Map testMessage) {
//        System.out.println("【FanoutReceiverB】消费者收到消息  : " +testMessage.toString());
//    }

//    @RabbitHandler
//    @RabbitListener(bindings = @QueueBinding(
//            value = @Queue(value = "fanout.C", autoDelete = "false"),
//            exchange = @Exchange(value = "fanoutExchange", delayed = "true")))
//    public void fanoutCProcess(Map testMessage) {
//        System.out.println("【FanoutReceiverC】消费者收到消息  : " +testMessage.toString());
//    }
}
